package net.csdn.business.common.domain.issue.event;

import lombok.*;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.util.List;

/**
 * @author likun
 * @date 2022/11/24 22:46
 */
@Data
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
public class LabelEventDto extends BaseEventDto {
    private List<Label> labels;

    private Boolean delete;

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Label implements Serializable {
        /**
         * 标签ID
         */
        private String objectId;

        /**
         * 标签名称
         */
        private String labelName;

        /**
         * 标签颜色
         */
        private String labelColor;
    }


    public static LabelEventDto buildChangeEvent(String id, String actionUid, boolean delete, List<Label> labels) {
        return LabelEventDto.builder()
                .id(id).actionUid(actionUid)
                .labels(labels).delete(delete)
                .build();
    }
}